package com.app.processor;

import java.io.BufferedReader;

import com.app.model.Car;

public class DataLineProcessor {
	
	private BufferedReader reader;
	
	public DataLineProcessor(BufferedReader reader) {
		this.reader = reader;
	}

	public String getDataLine(){
		try{
			String dataLine = reader.readLine();
			return dataLine.trim();
		}catch (Exception e) {
			System.out.println("Can`t read");
		}
		return null;
	}
	
	public Car processDataLine(String line) throws Exception{
		try{
			int car_haurse;
			//int car_haurse=Integer.parseInt(line); old
			Car  result = new  Car();
			//result.drive(car_haurse); old
			result.drive(car_haurse=Integer.parseInt(line));
			//System.out.println(car_haurse);
			return null;
		}catch (Exception e) {
			throw new Exception("Incorrect data line");
		}
	}
}
